home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / MACUNZIP / MACUNZIP.C < prev    next >
Text File  |  1991-08-17  |  2KB  |  60 lines

  1. /*  UnZip for the Macintosh                                          */
  2. /*                                                                   */
  3. /*  John Eng    July 1991                                            */
  4. /*                                                                   */
  5. /*  Based on the TURBO C Version 2.0.1 for the IBM by Samuel H.      */
  6. /*  Smith as modified by George M. Sipe for "portability" to UNIX,   */
  7. /*  Microsoft C for the IBM, and other machines.                     */
  8. /*                                                                   */
  9. /*  This file contains code to compensate for non-portability of     */
  10. /*  the main source code.  Please see comments in the main source    */
  11. /*  file for further information.                                    */
  12.  
  13.  
  14. /*  utime() and *memcpy() are not always found in UNIX libraries.    */
  15. /*  *memcpy() is defined here.  A version of utime() could probably  */
  16. /*  be written to work on the Macintosh, but is omitted here.        */
  17. /*  MacInit() is defined here to provide UNIX-style command line     */
  18. /*  arguments, which are not part of the typical Macintosh user      */
  19. /*  interface.                                                       */
  20.  
  21. int utime(f, t)
  22.     char            *f;
  23.     struct utimbuf    *t;
  24. {
  25. }
  26.  
  27. void *memcpy(s, ct, n)
  28.     unsigned char    *s, *ct;
  29.     register int    n;
  30. {
  31.     register unsigned char *s1, *s2;
  32.     s1 = s;
  33.     s2 = ct;
  34.     while (n > 0) {
  35.         *s1++ = *s2++;
  36.         n--;
  37.         }
  38. }
  39.  
  40. void MacInit(c, v)
  41.     int        *c;
  42.     char    **v;
  43. {
  44.     static char    fname[80];
  45.  
  46.     MaxApplZone();
  47.     prefix_of = (int *) malloc((hsize+1)*sizeof(int));
  48.     suffix_of = (byte *) malloc((hsize+1)*sizeof(byte));
  49.     stack = (byte *) malloc((hsize+1)*sizeof(byte));
  50.     printf("\fUnZip for the Apple Macintosh (John Eng)\n\n");
  51.     printf("This program is based on C source code written by Samuel H.");
  52.     printf(" Smith\nand George M. Sipe.\n\n");
  53.     printf("Filename? ");
  54.     gets(fname);
  55.     if (strlen(fname) > 0) {
  56.         v[1] = fname;
  57.         *c = 2;
  58.         }
  59.     else exit(0);
  60. }